package cn.yunhe.controller;
import cn.yunhe.service.IChinaService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;


@WebServlet("/before/ChinaSouServlet2")
public class ChinaSouServlet2 extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        response.setContentType("text/json;charset=UTF-8");
        PrintWriter out = response.getWriter();

        String keyword = request.getParameter("keyword");

        IChinaService chinaService = new IChinaService();

        String  list=chinaService.getAllChinaBycity(keyword);

        if (list!=null){
            out.print(list);
        }else {
            out.print("");
        }

    }
}
